import request from "@/utils/request"
import type { Login, Perm, Register, Role, RolePerm, UserRole } from "./type";

export const doLogin = (data: Login) => {
    return request.post("/auth/login", data);
}

export const doGetCaptcha = () => {
    return request.get("/auth/captcha")
}

export const doRegister = (register: Register) => {
    return request.post("/auth/register", register)
}

export const doLogout = () => {
    return request.post("/auth/logout");
}

export const getPermList = () => {
    return request.get("/auth/perm/list");
}

export const getRoleList = () => {
    return request.get("/auth/role/list");
}

export const addOnePerm = (perm: Perm) => {
    return request.post("/auth/perm/add", perm);
}

export const addOneRole = (role: Role) => {
    return request.post("/auth/role/add", role);
}

export const addOneUserRole = (data: UserRole) => {
    return request.post("/auth/role/user/add", data);
}

export const addOneRolePerm = (data: RolePerm) => {
    return request.post("/auth/role/perm/add", data);
}